<template>
  <div class="manage">
    <BillNav />
    <div class="manage-container">
      <n-empty
        v-if="!billList.length"
        description="暂无账单"
      >
        <template #extra>
          <n-button size="small"> 去添加 </n-button>
        </template>
      </n-empty>
      <n-grid
        cols="2 s:3 m:4 l:5 xl:6 2xl:7"
        :x-gap="12"
        :y-gap="12"
        responsive="screen"
      >
        <n-grid-item
          v-for="(item, index) in billList"
          :key="index"
        >
          <BillCard
            v-bind="item"
            :id="item.id"
            @select="handleSelect"
          />
        </n-grid-item>
      </n-grid>
    </div>
  </div>
</template>

<script lang="ts" setup>
  import { ref } from 'vue'
  import BillNav from './BillNav.vue'
  import BillCard from './BillCard.vue'

  // 名称
  const name = ref('')
  // 账单列表
  const billList = <any[]>[]
  //  添加账单
  function handleAddBill() {}

  // 获取账单列表
  function getBillList() {}

  // 选中列表
  function handleSelect(key: string, id: number) {
    switch (key) {
      case 'edit':
        break

      case 'delete':
        break
    }
  }
  // getBillList()
</script>

<style scoped lang="scss">
  .manage {
    &-top {
      height: 48px;
      padding: 0 16px;
      background-color: #fff;
      border-radius: $radius-sm;
    }
    &-container {
      height: calc(100vh - 190px);
      padding: $space-default;
      box-sizing: border-box;
      border-radius: $radius-sm;
    }
  }
</style>
